<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>MolTK C++ API: moltk/units.hpp Source File</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />

<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>

</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  <td id="projectlogo"><img alt="Logo" src="moltk55.png"/></td>
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">MolTK C++ API
   &#160;<span id="projectnumber">0.4.0</span>
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.5.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>File&#160;Members</span></a></li>
    </ul>
  </div>
<div class="header">
  <div class="headertitle">
<div class="title">moltk/units.hpp</div>  </div>
</div>
<div class="contents">
<a href="units_8hpp.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
<a name="l00002"></a>00002 <span class="comment">    MolTK is a Python and C++ toolkit for protein sequence/structure alignment and visualization</span>
<a name="l00003"></a>00003 <span class="comment">    Copyright (C) 2011  Christopher M. Bruns</span>
<a name="l00004"></a>00004 <span class="comment"></span>
<a name="l00005"></a>00005 <span class="comment">    This program is free software; you can redistribute it and/or modify</span>
<a name="l00006"></a>00006 <span class="comment">    it under the terms of the GNU General Public License as published by</span>
<a name="l00007"></a>00007 <span class="comment">    the Free Software Foundation; either version 2 of the License, or</span>
<a name="l00008"></a>00008 <span class="comment">    (at your option) any later version.</span>
<a name="l00009"></a>00009 <span class="comment"></span>
<a name="l00010"></a>00010 <span class="comment">    This program is distributed in the hope that it will be useful,</span>
<a name="l00011"></a>00011 <span class="comment">    but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
<a name="l00012"></a>00012 <span class="comment">    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span>
<a name="l00013"></a>00013 <span class="comment">    GNU General Public License for more details.</span>
<a name="l00014"></a>00014 <span class="comment"></span>
<a name="l00015"></a>00015 <span class="comment">    You should have received a copy of the GNU General Public License along</span>
<a name="l00016"></a>00016 <span class="comment">    with this program; if not, write to the Free Software Foundation, Inc.,</span>
<a name="l00017"></a>00017 <span class="comment">    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.</span>
<a name="l00018"></a>00018 <span class="comment">    </span>
<a name="l00019"></a>00019 <span class="comment">    Commercial users should ask about our dual licensing model.</span>
<a name="l00020"></a>00020 <span class="comment">    For questions contact: cmbruns@rotatingpenguin.com</span>
<a name="l00021"></a>00021 <span class="comment">*/</span>
<a name="l00022"></a>00022 
<a name="l00023"></a>00023 <span class="preprocessor">#ifndef MOLTK_UNITS_H</span>
<a name="l00024"></a>00024 <span class="preprocessor"></span><span class="preprocessor">#define MOLTK_UNITS_H</span>
<a name="l00025"></a>00025 <span class="preprocessor"></span>
<a name="l00026"></a>00026 <span class="comment">// Boost::units does not play well with gcc-xml and msvc 9</span>
<a name="l00027"></a>00027 <span class="comment">// so I decided to roll my own.</span>
<a name="l00028"></a>00028 
<a name="l00029"></a>00029 <span class="preprocessor">#include &quot;<a class="code" href="Real_8hpp.html">moltk/Real.hpp</a>&quot;</span>
<a name="l00030"></a>00030 <span class="preprocessor">#include &quot;boost/utility.hpp&quot;</span>
<a name="l00031"></a>00031 <span class="preprocessor">#include &lt;string&gt;</span>
<a name="l00032"></a>00032 <span class="preprocessor">#include &lt;cmath&gt;</span>
<a name="l00033"></a>00033 <span class="preprocessor">#include &lt;memory&gt;</span>
<a name="l00034"></a>00034 <span class="preprocessor">#include &lt;cassert&gt;</span>
<a name="l00035"></a>00035 
<a name="l00036"></a>00036 <span class="keyword">namespace </span>moltk {
<a name="l00040"></a><a class="code" href="namespacemoltk_1_1units.html">00040</a> <span class="keyword">namespace </span>units {
<a name="l00041"></a>00041 
<a name="l00043"></a>00043     <span class="comment">// Dimensions //</span>
<a name="l00045"></a>00045 <span class="comment"></span>
<a name="l00049"></a><a class="code" href="namespacemoltk_1_1units.html#afed1f2d4160617c10e7fd090f8ff7360">00049</a>     <span class="keyword">enum</span> <a class="code" href="namespacemoltk_1_1units.html#afed1f2d4160617c10e7fd090f8ff7360" title="DimensionIndex enumerates the dimension types used by the Dimension class.">DimensionIndex</a> {
<a name="l00050"></a><a class="code" href="namespacemoltk_1_1units.html#afed1f2d4160617c10e7fd090f8ff7360a59e856f36fd2bfa90321ec6e432dec0d">00050</a>         <a class="code" href="namespacemoltk_1_1units.html#afed1f2d4160617c10e7fd090f8ff7360a59e856f36fd2bfa90321ec6e432dec0d">DIMENSION_MASS</a>,
<a name="l00051"></a><a class="code" href="namespacemoltk_1_1units.html#afed1f2d4160617c10e7fd090f8ff7360a351ee817f5459adbc77b2ec5db260e88">00051</a>         <a class="code" href="namespacemoltk_1_1units.html#afed1f2d4160617c10e7fd090f8ff7360a351ee817f5459adbc77b2ec5db260e88">DIMENSION_LENGTH</a>,
<a name="l00052"></a><a class="code" href="namespacemoltk_1_1units.html#afed1f2d4160617c10e7fd090f8ff7360a5f0d01290e7b611e552ff8319d035cf9">00052</a>         <a class="code" href="namespacemoltk_1_1units.html#afed1f2d4160617c10e7fd090f8ff7360a5f0d01290e7b611e552ff8319d035cf9">DIMENSION_TIME</a>,
<a name="l00053"></a><a class="code" href="namespacemoltk_1_1units.html#afed1f2d4160617c10e7fd090f8ff7360a1346f4bcddd1ebd3f6a48487e0441bd7">00053</a>         <a class="code" href="namespacemoltk_1_1units.html#afed1f2d4160617c10e7fd090f8ff7360a1346f4bcddd1ebd3f6a48487e0441bd7">DIMENSION_CHARGE</a>,
<a name="l00054"></a><a class="code" href="namespacemoltk_1_1units.html#afed1f2d4160617c10e7fd090f8ff7360ac99ba632ad5179828b5b8cc695cf4a15">00054</a>         <a class="code" href="namespacemoltk_1_1units.html#afed1f2d4160617c10e7fd090f8ff7360ac99ba632ad5179828b5b8cc695cf4a15">DIMENSION_AMOUNT</a>,
<a name="l00055"></a><a class="code" href="namespacemoltk_1_1units.html#afed1f2d4160617c10e7fd090f8ff7360af9dce97ec1ac48d83325b99f9ae02215">00055</a>         <a class="code" href="namespacemoltk_1_1units.html#afed1f2d4160617c10e7fd090f8ff7360af9dce97ec1ac48d83325b99f9ae02215">DIMENSION_ANGLE</a>,
<a name="l00056"></a><a class="code" href="namespacemoltk_1_1units.html#afed1f2d4160617c10e7fd090f8ff7360a88c696a7f3b61520db07aa3e260770c6">00056</a>         <a class="code" href="namespacemoltk_1_1units.html#afed1f2d4160617c10e7fd090f8ff7360a88c696a7f3b61520db07aa3e260770c6">DIMENSION_INFORMATION</a>
<a name="l00057"></a>00057     };
<a name="l00058"></a>00058 
<a name="l00062"></a>00062     <span class="keyword">template</span>&lt;<span class="keywordtype">int</span> M, <span class="keywordtype">int</span> L, <span class="keywordtype">int</span> T, <span class="keywordtype">int</span> Q, <span class="keywordtype">int</span> N, <span class="keywordtype">int</span> A, <span class="keywordtype">int</span> I&gt;
<a name="l00063"></a><a class="code" href="structmoltk_1_1units_1_1Dimension.html">00063</a>     <span class="keyword">struct </span><a class="code" href="structmoltk_1_1units_1_1Dimension.html" title="Dimension represents a physical dimension such as mass, length, time, etc.">Dimension</a> : boost::noncopyable {
<a name="l00064"></a><a class="code" href="structmoltk_1_1units_1_1Dimension.html#ac9819c45990ae40740d2a68f190bf9d5">00064</a>         <span class="keyword">typedef</span> <a class="code" href="structmoltk_1_1units_1_1Dimension.html" title="Dimension represents a physical dimension such as mass, length, time, etc.">Dimension&lt;M*2, L*2, T*2, Q*2, N*2, A*2, I*2&gt;</a> <a class="code" href="structmoltk_1_1units_1_1Dimension.html#ac9819c45990ae40740d2a68f190bf9d5">SquareType</a>;
<a name="l00065"></a><a class="code" href="structmoltk_1_1units_1_1Dimension.html#ad234223c7c2dae7fe9d9a7a4cb0ebb7c">00065</a>         <span class="keyword">typedef</span> <a class="code" href="structmoltk_1_1units_1_1Dimension.html" title="Dimension represents a physical dimension such as mass, length, time, etc.">Dimension</a>&lt;M*2, L/2, T/2, Q/2, N/2, A/2, I/2&gt; <a class="code" href="structmoltk_1_1units_1_1Dimension.html#ad234223c7c2dae7fe9d9a7a4cb0ebb7c">SquareRootType</a>;
<a name="l00066"></a>00066     };
<a name="l00067"></a>00067 
<a name="l00068"></a>00068     <span class="comment">//      Dimension&lt; M, L, T, Q, N, A, I&gt;</span>
<a name="l00069"></a><a class="code" href="namespacemoltk_1_1units.html#ad1f08edba26688bdf12c25384d9155cf">00069</a>     <span class="keyword">typedef</span> <a class="code" href="structmoltk_1_1units_1_1Dimension.html" title="Dimension represents a physical dimension such as mass, length, time, etc.">Dimension&lt; 0, 0, 0, 0, 0, 0, 0&gt;</a> <a class="code" href="namespacemoltk_1_1units.html#ad1f08edba26688bdf12c25384d9155cf">DimensionlessDimension</a>;
<a name="l00070"></a><a class="code" href="namespacemoltk_1_1units.html#a6a3fd9ad3f631a00896d41b6df7c7f32">00070</a>     <span class="keyword">typedef</span> <a class="code" href="structmoltk_1_1units_1_1Dimension.html" title="Dimension represents a physical dimension such as mass, length, time, etc.">Dimension&lt; 0, 0, 0, 0, 0, 0, 1&gt;</a> <a class="code" href="namespacemoltk_1_1units.html#a6a3fd9ad3f631a00896d41b6df7c7f32">InformationDimension</a>;
<a name="l00071"></a><a class="code" href="namespacemoltk_1_1units.html#aff2268d3543167fc6e52aa3f139e8cfc">00071</a>     <span class="keyword">typedef</span> <a class="code" href="structmoltk_1_1units_1_1Dimension.html" title="Dimension represents a physical dimension such as mass, length, time, etc.">Dimension&lt; 0, 1, 0, 0, 0, 0, 0&gt;</a> <a class="code" href="namespacemoltk_1_1units.html#aff2268d3543167fc6e52aa3f139e8cfc">LengthDimension</a>;
<a name="l00072"></a><a class="code" href="namespacemoltk_1_1units.html#ac51c0610ed480a567fe39559188231b4">00072</a>     <span class="keyword">typedef</span> <a class="code" href="structmoltk_1_1units_1_1Dimension.html" title="Dimension represents a physical dimension such as mass, length, time, etc.">Dimension&lt; 0, 2, 0, 0, 0, 0, 0&gt;</a> <a class="code" href="namespacemoltk_1_1units.html#ac51c0610ed480a567fe39559188231b4">AreaDimension</a>;
<a name="l00073"></a><a class="code" href="namespacemoltk_1_1units.html#a1ae9cb3c0e169e9bc8e9f3efa345fedf">00073</a>     <span class="keyword">typedef</span> <a class="code" href="structmoltk_1_1units_1_1Dimension.html" title="Dimension represents a physical dimension such as mass, length, time, etc.">Dimension&lt; 0, 0, 0, 0, 0, 1, 0&gt;</a> <a class="code" href="namespacemoltk_1_1units.html#a1ae9cb3c0e169e9bc8e9f3efa345fedf">AngleDimension</a>;
<a name="l00074"></a>00074 
<a name="l00076"></a>00076     <span class="comment">// Units //</span>
<a name="l00078"></a>00078 <span class="comment"></span>
<a name="l00082"></a>00082     <span class="keyword">template</span>&lt;<span class="keyword">class</span> D&gt;
<a name="l00083"></a><a class="code" href="structmoltk_1_1units_1_1Unit.html">00083</a>     <span class="keyword">struct </span><a class="code" href="structmoltk_1_1units_1_1Unit.html" title="Unit represents a unit of measure, such as gram, nanometer, or second.">Unit</a> : boost::noncopyable
<a name="l00084"></a>00084     {
<a name="l00085"></a><a class="code" href="structmoltk_1_1units_1_1Unit.html#a4e4e24eb5e9a5d43321305d915c538f9">00085</a>         <span class="keyword">typedef</span> D <a class="code" href="structmoltk_1_1units_1_1Unit.html#a4e4e24eb5e9a5d43321305d915c538f9">DimensionType</a>;
<a name="l00086"></a><a class="code" href="structmoltk_1_1units_1_1Unit.html#af24ff59360262fa4ea03af8d6d20f0c3">00086</a>         <span class="keyword">typedef</span> <a class="code" href="structmoltk_1_1units_1_1Unit.html" title="Unit represents a unit of measure, such as gram, nanometer, or second.">Unit&lt;D&gt;</a> <a class="code" href="structmoltk_1_1units_1_1Unit.html#af24ff59360262fa4ea03af8d6d20f0c3">ThisType</a>;
<a name="l00087"></a><a class="code" href="structmoltk_1_1units_1_1Unit.html#a11d0f74ab1654292bf50a66aced07fa5">00087</a>         <span class="keyword">typedef</span> <a class="code" href="structmoltk_1_1units_1_1Unit.html" title="Unit represents a unit of measure, such as gram, nanometer, or second.">Unit&lt;typename DimensionType::SquareType&gt;</a> <a class="code" href="structmoltk_1_1units_1_1Unit.html#a11d0f74ab1654292bf50a66aced07fa5">SquareType</a>;
<a name="l00088"></a><a class="code" href="structmoltk_1_1units_1_1Unit.html#aec3622514f1535f0ff7eef06d83c0de1">00088</a>         <span class="keyword">typedef</span> <a class="code" href="structmoltk_1_1units_1_1Unit.html" title="Unit represents a unit of measure, such as gram, nanometer, or second.">Unit&lt;typename DimensionType::SquareRootType&gt;</a> <a class="code" href="structmoltk_1_1units_1_1Unit.html#aec3622514f1535f0ff7eef06d83c0de1">SquareRootType</a>;
<a name="l00089"></a>00089 
<a name="l00090"></a><a class="code" href="structmoltk_1_1units_1_1Unit.html#a88ec42b34496c01e0ae6df3c922f1057">00090</a>         <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="structmoltk_1_1units_1_1Unit.html#a88ec42b34496c01e0ae6df3c922f1057">write_name</a>(std::ostream&amp; os) {os &lt;&lt; <a class="code" href="namespacemoltk_1_1units.html#a482de8717eb99d9abb41ac1792bc8146">get_unit_name</a>(<a class="code" href="structmoltk_1_1units_1_1Unit.html#a826fc8257f93873c15845a01e465dfc3">get_instance</a>());}
<a name="l00091"></a><a class="code" href="structmoltk_1_1units_1_1Unit.html#a68524ad9bdc45519443137aacec15e24">00091</a>         <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="structmoltk_1_1units_1_1Unit.html#a68524ad9bdc45519443137aacec15e24">write_symbol</a>(std::ostream&amp; os) {os &lt;&lt; <a class="code" href="namespacemoltk_1_1units.html#a757570c1709c56d1493956f91d5ecd82">get_unit_symbol</a>(<a class="code" href="structmoltk_1_1units_1_1Unit.html#a826fc8257f93873c15845a01e465dfc3">get_instance</a>());}
<a name="l00092"></a><a class="code" href="structmoltk_1_1units_1_1Unit.html#a826fc8257f93873c15845a01e465dfc3">00092</a>         <span class="keyword">static</span> <span class="keyword">const</span> <a class="code" href="structmoltk_1_1units_1_1Unit.html" title="Unit represents a unit of measure, such as gram, nanometer, or second.">ThisType</a>&amp; <a class="code" href="structmoltk_1_1units_1_1Unit.html#a826fc8257f93873c15845a01e465dfc3">get_instance</a>() {
<a name="l00093"></a>00093             <span class="keyword">static</span> std::auto_ptr&lt;ThisType&gt; singleton_pointer(NULL);
<a name="l00094"></a>00094             <span class="keywordflow">if</span> (!singleton_pointer.get()) 
<a name="l00095"></a>00095                 singleton_pointer.reset( <span class="keyword">new</span> <a class="code" href="structmoltk_1_1units_1_1Unit.html" title="Unit represents a unit of measure, such as gram, nanometer, or second.">ThisType</a>() );
<a name="l00096"></a>00096             <span class="keywordflow">return</span> *singleton_pointer.get();
<a name="l00097"></a>00097         }
<a name="l00098"></a>00098     };
<a name="l00099"></a>00099 
<a name="l00100"></a><a class="code" href="namespacemoltk_1_1units.html#a7ffc3778dcfa8f3ab61be0266d7705db">00100</a>     <span class="keyword">typedef</span> <a class="code" href="structmoltk_1_1units_1_1Unit.html" title="Unit represents a unit of measure, such as gram, nanometer, or second.">Unit&lt;InformationDimension&gt;</a> <a class="code" href="namespacemoltk_1_1units.html#a7ffc3778dcfa8f3ab61be0266d7705db">BitUnit</a>;
<a name="l00101"></a><a class="code" href="namespacemoltk_1_1units.html#a757570c1709c56d1493956f91d5ecd82">00101</a>     <span class="keyword">inline</span> std::string <a class="code" href="namespacemoltk_1_1units.html#a757570c1709c56d1493956f91d5ecd82">get_unit_symbol</a>(<span class="keyword">const</span> <a class="code" href="structmoltk_1_1units_1_1Unit.html" title="Unit represents a unit of measure, such as gram, nanometer, or second.">BitUnit</a>&amp;) {<span class="keywordflow">return</span> <span class="stringliteral">&quot;b&quot;</span>;}
<a name="l00102"></a><a class="code" href="namespacemoltk_1_1units.html#a482de8717eb99d9abb41ac1792bc8146">00102</a>     <span class="keyword">inline</span> std::string <a class="code" href="namespacemoltk_1_1units.html#a482de8717eb99d9abb41ac1792bc8146">get_unit_name</a>(<span class="keyword">const</span> <a class="code" href="structmoltk_1_1units_1_1Unit.html" title="Unit represents a unit of measure, such as gram, nanometer, or second.">BitUnit</a>&amp;) {<span class="keywordflow">return</span> <span class="stringliteral">&quot;bit&quot;</span>;}
<a name="l00103"></a><a class="code" href="namespacemoltk_1_1units.html#a602a3e9be116d69627ba824da7d22e72">00103</a>     <span class="keyword">static</span> <span class="keyword">const</span> <a class="code" href="structmoltk_1_1units_1_1Unit.html" title="Unit represents a unit of measure, such as gram, nanometer, or second.">BitUnit</a>&amp; <a class="code" href="namespacemoltk_1_1units.html#a602a3e9be116d69627ba824da7d22e72">bit</a> = <a class="code" href="structmoltk_1_1units_1_1Unit.html#a826fc8257f93873c15845a01e465dfc3">BitUnit::get_instance</a>();
<a name="l00104"></a>00104 
<a name="l00105"></a><a class="code" href="namespacemoltk_1_1units.html#ac9eb406e7079ae577d9d15e1b4c15a72">00105</a>     <span class="keyword">typedef</span> <a class="code" href="structmoltk_1_1units_1_1Unit.html" title="Unit represents a unit of measure, such as gram, nanometer, or second.">Unit&lt;LengthDimension&gt;</a> <a class="code" href="namespacemoltk_1_1units.html#ac9eb406e7079ae577d9d15e1b4c15a72">NanometerUnit</a>;
<a name="l00106"></a>00106     <span class="keyword">inline</span> std::string <a class="code" href="namespacemoltk_1_1units.html#a757570c1709c56d1493956f91d5ecd82">get_unit_symbol</a>(<span class="keyword">const</span> <a class="code" href="structmoltk_1_1units_1_1Unit.html" title="Unit represents a unit of measure, such as gram, nanometer, or second.">NanometerUnit</a>&amp;) {<span class="keywordflow">return</span> <span class="stringliteral">&quot;nm&quot;</span>;}
<a name="l00107"></a>00107     <span class="keyword">inline</span> std::string <a class="code" href="namespacemoltk_1_1units.html#a482de8717eb99d9abb41ac1792bc8146">get_unit_name</a>(<span class="keyword">const</span> <a class="code" href="namespacemoltk_1_1units.html#ac9eb406e7079ae577d9d15e1b4c15a72">NanometerUnit</a>&amp;) {<span class="keywordflow">return</span> <span class="stringliteral">&quot;nanometer&quot;</span>;}
<a name="l00108"></a><a class="code" href="namespacemoltk_1_1units.html#afe1d41f95fc042a8d19d25b877415b2d">00108</a>     <span class="keyword">static</span> <span class="keyword">const</span> <a class="code" href="structmoltk_1_1units_1_1Unit.html" title="Unit represents a unit of measure, such as gram, nanometer, or second.">NanometerUnit</a>&amp; <a class="code" href="namespacemoltk_1_1units.html#afe1d41f95fc042a8d19d25b877415b2d">nanometer</a> = <a class="code" href="structmoltk_1_1units_1_1Unit.html#a826fc8257f93873c15845a01e465dfc3">NanometerUnit::get_instance</a>();
<a name="l00109"></a>00109 
<a name="l00110"></a><a class="code" href="namespacemoltk_1_1units.html#ae2600819c28aa83da74e0c57c9282044">00110</a>     <span class="keyword">typedef</span> <a class="code" href="structmoltk_1_1units_1_1Unit.html" title="Unit represents a unit of measure, such as gram, nanometer, or second.">Unit&lt;AngleDimension&gt;</a> <a class="code" href="namespacemoltk_1_1units.html#ae2600819c28aa83da74e0c57c9282044">RadianUnit</a>;
<a name="l00111"></a>00111     <span class="keyword">inline</span> std::string <a class="code" href="namespacemoltk_1_1units.html#a757570c1709c56d1493956f91d5ecd82">get_unit_symbol</a>(<span class="keyword">const</span> <a class="code" href="structmoltk_1_1units_1_1Unit.html" title="Unit represents a unit of measure, such as gram, nanometer, or second.">RadianUnit</a>&amp;) {<span class="keywordflow">return</span> <span class="stringliteral">&quot;rad&quot;</span>;}
<a name="l00112"></a>00112     <span class="keyword">inline</span> std::string <a class="code" href="namespacemoltk_1_1units.html#a482de8717eb99d9abb41ac1792bc8146">get_unit_name</a>(<span class="keyword">const</span> <a class="code" href="namespacemoltk_1_1units.html#ae2600819c28aa83da74e0c57c9282044">RadianUnit</a>&amp;) {<span class="keywordflow">return</span> <span class="stringliteral">&quot;radian&quot;</span>;}
<a name="l00113"></a><a class="code" href="namespacemoltk_1_1units.html#a516154a0a09f1ce7437b739ce48e0409">00113</a>     <span class="keyword">static</span> <span class="keyword">const</span> <a class="code" href="structmoltk_1_1units_1_1Unit.html" title="Unit represents a unit of measure, such as gram, nanometer, or second.">RadianUnit</a>&amp; <a class="code" href="namespacemoltk_1_1units.html#a516154a0a09f1ce7437b739ce48e0409">radian</a> = <a class="code" href="structmoltk_1_1units_1_1Unit.html#a826fc8257f93873c15845a01e465dfc3">RadianUnit::get_instance</a>();
<a name="l00114"></a>00114 
<a name="l00116"></a>00116     <span class="comment">// Quantities //</span>
<a name="l00118"></a>00118 <span class="comment"></span>
<a name="l00130"></a>00130     <span class="keyword">template</span>&lt;<span class="keyword">class</span> U, <span class="keyword">class</span> Y = Real&gt;
<a name="l00131"></a><a class="code" href="structmoltk_1_1units_1_1Quantity.html">00131</a>     <span class="keyword">struct </span><a class="code" href="structmoltk_1_1units_1_1Quantity.html" title="Quantity represents a physical value with a unit, such as &quot;5.6 nanometers&quot;.">Quantity</a> 
<a name="l00132"></a>00132     {
<a name="l00133"></a><a class="code" href="structmoltk_1_1units_1_1Quantity.html#a4e3905fd140d4a6b630a6a0b73a93bdf">00133</a>         <span class="keyword">typedef</span> U <a class="code" href="structmoltk_1_1units_1_1Quantity.html#a4e3905fd140d4a6b630a6a0b73a93bdf">UnitType</a>;
<a name="l00134"></a><a class="code" href="structmoltk_1_1units_1_1Quantity.html#aaa757baa200137d668c47d6d7c2c9d9e">00134</a>         <span class="keyword">typedef</span> Y <a class="code" href="structmoltk_1_1units_1_1Quantity.html#aaa757baa200137d668c47d6d7c2c9d9e">ValueType</a>;
<a name="l00135"></a><a class="code" href="structmoltk_1_1units_1_1Quantity.html#a6a58dc9d5a0e3dfbad24bdb3ebe8f70a">00135</a>         <span class="keyword">typedef</span> <a class="code" href="structmoltk_1_1units_1_1Quantity.html" title="Quantity represents a physical value with a unit, such as &quot;5.6 nanometers&quot;.">Quantity&lt;U,Y&gt;</a> <a class="code" href="structmoltk_1_1units_1_1Quantity.html#a6a58dc9d5a0e3dfbad24bdb3ebe8f70a">ThisType</a>;
<a name="l00136"></a><a class="code" href="structmoltk_1_1units_1_1Quantity.html#ab8db4eeb0cf1adc544fec23c12c0c070">00136</a>         <span class="keyword">typedef</span> <a class="code" href="structmoltk_1_1units_1_1Quantity.html" title="Quantity represents a physical value with a unit, such as &quot;5.6 nanometers&quot;.">Quantity&lt;typename UnitType::SquareType, Y&gt;</a> <a class="code" href="structmoltk_1_1units_1_1Quantity.html#ab8db4eeb0cf1adc544fec23c12c0c070">SquareType</a>;
<a name="l00137"></a><a class="code" href="structmoltk_1_1units_1_1Quantity.html#a819bd6379a7cf717890d92d448439bab">00137</a>         <span class="keyword">typedef</span> <a class="code" href="structmoltk_1_1units_1_1Quantity.html" title="Quantity represents a physical value with a unit, such as &quot;5.6 nanometers&quot;.">Quantity&lt;typename UnitType::SquareRootType, Y&gt;</a> <a class="code" href="structmoltk_1_1units_1_1Quantity.html#a819bd6379a7cf717890d92d448439bab">SquareRootType</a>;
<a name="l00138"></a>00138 
<a name="l00139"></a><a class="code" href="structmoltk_1_1units_1_1Quantity.html#afaf8597b93b604c3980218dceefff4c8">00139</a>         <a class="code" href="structmoltk_1_1units_1_1Quantity.html#aaa757baa200137d668c47d6d7c2c9d9e">ValueType</a> <a class="code" href="structmoltk_1_1units_1_1Quantity.html#afaf8597b93b604c3980218dceefff4c8">value</a>;
<a name="l00140"></a>00140 
<a name="l00141"></a>00141         <span class="comment">// constructors / assignment</span>
<a name="l00142"></a><a class="code" href="structmoltk_1_1units_1_1Quantity.html#a87d1fc102beac6ccb571eff3e16c8e80">00142</a>         <a class="code" href="structmoltk_1_1units_1_1Quantity.html#a87d1fc102beac6ccb571eff3e16c8e80">Quantity</a>() {}
<a name="l00143"></a><a class="code" href="structmoltk_1_1units_1_1Quantity.html#a36143fa96a1946d55240228a1e9082b1">00143</a>         <a class="code" href="structmoltk_1_1units_1_1Quantity.html#a36143fa96a1946d55240228a1e9082b1">Quantity</a>(<span class="keyword">const</span> Y&amp; v, <span class="keyword">const</span> U&amp; u) : <a class="code" href="structmoltk_1_1units_1_1Quantity.html#afaf8597b93b604c3980218dceefff4c8">value</a>(v) {}
<a name="l00144"></a><a class="code" href="structmoltk_1_1units_1_1Quantity.html#a1da8e7739983f5da248e6e61fc173610">00144</a>         <a class="code" href="structmoltk_1_1units_1_1Quantity.html#a1da8e7739983f5da248e6e61fc173610">Quantity</a>(<span class="keyword">const</span> <a class="code" href="structmoltk_1_1units_1_1Quantity.html" title="Quantity represents a physical value with a unit, such as &quot;5.6 nanometers&quot;.">ThisType</a>&amp; rhs) : <a class="code" href="structmoltk_1_1units_1_1Quantity.html#afaf8597b93b604c3980218dceefff4c8">value</a>(rhs.<a class="code" href="structmoltk_1_1units_1_1Quantity.html#afaf8597b93b604c3980218dceefff4c8">value</a>) {}
<a name="l00145"></a>00145 
<a name="l00146"></a><a class="code" href="structmoltk_1_1units_1_1Quantity.html#ae79595506749bea30196c86eb176d4a0">00146</a>         <a class="code" href="structmoltk_1_1units_1_1Quantity.html" title="Quantity represents a physical value with a unit, such as &quot;5.6 nanometers&quot;.">ThisType</a>&amp; <a class="code" href="structmoltk_1_1units_1_1Quantity.html#ae79595506749bea30196c86eb176d4a0">operator=</a>(<span class="keyword">const</span> <a class="code" href="structmoltk_1_1units_1_1Quantity.html" title="Quantity represents a physical value with a unit, such as &quot;5.6 nanometers&quot;.">ThisType</a>&amp; rhs)
<a name="l00147"></a>00147         {
<a name="l00148"></a>00148             <a class="code" href="structmoltk_1_1units_1_1Quantity.html#afaf8597b93b604c3980218dceefff4c8">value</a> = rhs.<a class="code" href="structmoltk_1_1units_1_1Quantity.html#afaf8597b93b604c3980218dceefff4c8">value</a>;
<a name="l00149"></a>00149             <span class="keywordflow">return</span> *<span class="keyword">this</span>;
<a name="l00150"></a>00150         }
<a name="l00151"></a>00151 
<a name="l00153"></a>00153         <span class="comment">// arithmetic operators //</span>
<a name="l00155"></a>00155 <span class="comment"></span>
<a name="l00156"></a>00156         <span class="comment">// unary +/-</span>
<a name="l00157"></a><a class="code" href="structmoltk_1_1units_1_1Quantity.html#ad1a558068ed9901932abeead3f4399af">00157</a>         <span class="keyword">const</span> <a class="code" href="structmoltk_1_1units_1_1Quantity.html" title="Quantity represents a physical value with a unit, such as &quot;5.6 nanometers&quot;.">ThisType</a>&amp; <a class="code" href="structmoltk_1_1units_1_1Quantity.html#ad1a558068ed9901932abeead3f4399af">operator+</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> *<span class="keyword">this</span>; }
<a name="l00158"></a><a class="code" href="structmoltk_1_1units_1_1Quantity.html#a77ab97cc7b61aee849498349049c87df">00158</a>         <a class="code" href="structmoltk_1_1units_1_1Quantity.html" title="Quantity represents a physical value with a unit, such as &quot;5.6 nanometers&quot;.">ThisType</a>&amp; <a class="code" href="structmoltk_1_1units_1_1Quantity.html#a77ab97cc7b61aee849498349049c87df">operator+</a>() { <span class="keywordflow">return</span> *<span class="keyword">this</span>; }
<a name="l00159"></a><a class="code" href="structmoltk_1_1units_1_1Quantity.html#ad8d175490ad7205edef7183f21399781">00159</a>         <a class="code" href="structmoltk_1_1units_1_1Quantity.html" title="Quantity represents a physical value with a unit, such as &quot;5.6 nanometers&quot;.">ThisType</a> <a class="code" href="structmoltk_1_1units_1_1Quantity.html#ad8d175490ad7205edef7183f21399781">operator-</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="structmoltk_1_1units_1_1Quantity.html#a6a58dc9d5a0e3dfbad24bdb3ebe8f70a">ThisType</a>(-<a class="code" href="structmoltk_1_1units_1_1Quantity.html#afaf8597b93b604c3980218dceefff4c8">value</a>); }
<a name="l00160"></a>00160 
<a name="l00161"></a>00161         <span class="comment">// addition</span>
<a name="l00162"></a><a class="code" href="structmoltk_1_1units_1_1Quantity.html#a02b501904dd261e8a12281e37dd653ba">00162</a>         <a class="code" href="structmoltk_1_1units_1_1Quantity.html" title="Quantity represents a physical value with a unit, such as &quot;5.6 nanometers&quot;.">ThisType</a> <a class="code" href="structmoltk_1_1units_1_1Quantity.html#ad1a558068ed9901932abeead3f4399af">operator+</a>(<span class="keyword">const</span> <a class="code" href="structmoltk_1_1units_1_1Quantity.html" title="Quantity represents a physical value with a unit, such as &quot;5.6 nanometers&quot;.">ThisType</a>&amp; rhs)<span class="keyword"> const </span>
<a name="l00163"></a>00163 <span class="keyword">        </span>{
<a name="l00164"></a>00164             <span class="keywordflow">return</span> <a class="code" href="structmoltk_1_1units_1_1Quantity.html#a6a58dc9d5a0e3dfbad24bdb3ebe8f70a">ThisType</a>(<a class="code" href="structmoltk_1_1units_1_1Quantity.html#afaf8597b93b604c3980218dceefff4c8">value</a> + rhs.<a class="code" href="structmoltk_1_1units_1_1Quantity.html#afaf8597b93b604c3980218dceefff4c8">value</a>);
<a name="l00165"></a>00165         }
<a name="l00166"></a>00166 
<a name="l00167"></a><a class="code" href="structmoltk_1_1units_1_1Quantity.html#a097b0ea7e5960b91604d1b8d9d1a301f">00167</a>         <a class="code" href="structmoltk_1_1units_1_1Quantity.html" title="Quantity represents a physical value with a unit, such as &quot;5.6 nanometers&quot;.">ThisType</a>&amp; <a class="code" href="structmoltk_1_1units_1_1Quantity.html#a097b0ea7e5960b91604d1b8d9d1a301f">operator+=</a>(<span class="keyword">const</span> <a class="code" href="structmoltk_1_1units_1_1Quantity.html" title="Quantity represents a physical value with a unit, such as &quot;5.6 nanometers&quot;.">ThisType</a>&amp; rhs) {
<a name="l00168"></a>00168             <a class="code" href="structmoltk_1_1units_1_1Quantity.html#afaf8597b93b604c3980218dceefff4c8">value</a> += rhs.<a class="code" href="structmoltk_1_1units_1_1Quantity.html#afaf8597b93b604c3980218dceefff4c8">value</a>;
<a name="l00169"></a>00169             <span class="keywordflow">return</span> *<span class="keyword">this</span>;
<a name="l00170"></a>00170         }
<a name="l00171"></a>00171 
<a name="l00172"></a>00172         <span class="comment">// subtraction</span>
<a name="l00173"></a><a class="code" href="structmoltk_1_1units_1_1Quantity.html#ad60a3518389c50d644c595d6c8df0ca3">00173</a>         <a class="code" href="structmoltk_1_1units_1_1Quantity.html" title="Quantity represents a physical value with a unit, such as &quot;5.6 nanometers&quot;.">ThisType</a> <a class="code" href="structmoltk_1_1units_1_1Quantity.html#ad60a3518389c50d644c595d6c8df0ca3">operator-</a>(<span class="keyword">const</span> <a class="code" href="structmoltk_1_1units_1_1Quantity.html" title="Quantity represents a physical value with a unit, such as &quot;5.6 nanometers&quot;.">ThisType</a>&amp; rhs)<span class="keyword"> const </span>{
<a name="l00174"></a>00174             <span class="keywordflow">return</span> <a class="code" href="structmoltk_1_1units_1_1Quantity.html#a6a58dc9d5a0e3dfbad24bdb3ebe8f70a">ThisType</a>(<a class="code" href="structmoltk_1_1units_1_1Quantity.html#afaf8597b93b604c3980218dceefff4c8">value</a> - rhs.<a class="code" href="structmoltk_1_1units_1_1Quantity.html#afaf8597b93b604c3980218dceefff4c8">value</a>);
<a name="l00175"></a>00175         }
<a name="l00176"></a>00176 
<a name="l00177"></a><a class="code" href="structmoltk_1_1units_1_1Quantity.html#a5eec38f98100ae0c1521f4cdf562620d">00177</a>         <a class="code" href="structmoltk_1_1units_1_1Quantity.html" title="Quantity represents a physical value with a unit, such as &quot;5.6 nanometers&quot;.">ThisType</a>&amp; <a class="code" href="structmoltk_1_1units_1_1Quantity.html#a5eec38f98100ae0c1521f4cdf562620d">operator-=</a>(<span class="keyword">const</span> <a class="code" href="structmoltk_1_1units_1_1Quantity.html" title="Quantity represents a physical value with a unit, such as &quot;5.6 nanometers&quot;.">ThisType</a>&amp; rhs) {
<a name="l00178"></a>00178             <a class="code" href="structmoltk_1_1units_1_1Quantity.html#afaf8597b93b604c3980218dceefff4c8">value</a> -= rhs.<a class="code" href="structmoltk_1_1units_1_1Quantity.html#afaf8597b93b604c3980218dceefff4c8">value</a>;
<a name="l00179"></a>00179             <span class="keywordflow">return</span> *<span class="keyword">this</span>;
<a name="l00180"></a>00180         }
<a name="l00181"></a>00181 
<a name="l00182"></a>00182         <span class="comment">// multiplication</span>
<a name="l00183"></a>00183         <span class="comment">// Quantity = Quantity * real</span>
<a name="l00184"></a><a class="code" href="structmoltk_1_1units_1_1Quantity.html#af27cc99b7d32f0b34b3bd2333e300aeb">00184</a>         <a class="code" href="structmoltk_1_1units_1_1Quantity.html" title="Quantity represents a physical value with a unit, such as &quot;5.6 nanometers&quot;.">ThisType</a> <a class="code" href="structmoltk_1_1units_1_1Quantity.html#af27cc99b7d32f0b34b3bd2333e300aeb">operator*</a>(<a class="code" href="namespacemoltk.html#afe6fbd8f5686b34143c2742fcc97292c" title="Real represents a real number, such as 5.6.">Real</a> rhs)<span class="keyword"> const </span>{
<a name="l00185"></a>00185             <span class="keywordflow">return</span> <a class="code" href="structmoltk_1_1units_1_1Quantity.html#a6a58dc9d5a0e3dfbad24bdb3ebe8f70a">ThisType</a>(<a class="code" href="structmoltk_1_1units_1_1Quantity.html#afaf8597b93b604c3980218dceefff4c8">value</a> * rhs);
<a name="l00186"></a>00186         }
<a name="l00187"></a>00187 
<a name="l00188"></a><a class="code" href="structmoltk_1_1units_1_1Quantity.html#a4c24e239dc561f3b75f25091e9aab069">00188</a>         <a class="code" href="structmoltk_1_1units_1_1Quantity.html" title="Quantity represents a physical value with a unit, such as &quot;5.6 nanometers&quot;.">ThisType</a> <a class="code" href="structmoltk_1_1units_1_1Quantity.html#a4c24e239dc561f3b75f25091e9aab069">operator*=</a>(<a class="code" href="namespacemoltk.html#afe6fbd8f5686b34143c2742fcc97292c" title="Real represents a real number, such as 5.6.">Real</a> rhs) {
<a name="l00189"></a>00189             <a class="code" href="structmoltk_1_1units_1_1Quantity.html#afaf8597b93b604c3980218dceefff4c8">value</a> *= rhs;
<a name="l00190"></a>00190             <span class="keywordflow">return</span> *<span class="keyword">this</span>;
<a name="l00191"></a>00191         }
<a name="l00192"></a>00192 
<a name="l00193"></a>00193         <span class="comment">// Quantity = real * Quantity</span>
<a name="l00194"></a><a class="code" href="structmoltk_1_1units_1_1Quantity.html#a520dd177b7efb60cf036c290f15a6ffc">00194</a>         <span class="keyword">inline</span> <span class="keyword">friend</span> <a class="code" href="structmoltk_1_1units_1_1Quantity.html" title="Quantity represents a physical value with a unit, such as &quot;5.6 nanometers&quot;.">ThisType</a> <a class="code" href="structmoltk_1_1units_1_1Quantity.html#a520dd177b7efb60cf036c290f15a6ffc">operator*</a>(<a class="code" href="namespacemoltk.html#afe6fbd8f5686b34143c2742fcc97292c" title="Real represents a real number, such as 5.6.">moltk::Real</a> lhs, <span class="keyword">const</span> <a class="code" href="structmoltk_1_1units_1_1Quantity.html" title="Quantity represents a physical value with a unit, such as &quot;5.6 nanometers&quot;.">ThisType</a>&amp; rhs) {
<a name="l00195"></a>00195             <span class="keywordflow">return</span> <a class="code" href="structmoltk_1_1units_1_1Quantity.html#a6a58dc9d5a0e3dfbad24bdb3ebe8f70a">ThisType</a>(lhs * rhs.<a class="code" href="structmoltk_1_1units_1_1Quantity.html#afaf8597b93b604c3980218dceefff4c8">value</a>);
<a name="l00196"></a>00196         }
<a name="l00197"></a>00197 
<a name="l00198"></a>00198         <span class="comment">// division</span>
<a name="l00199"></a><a class="code" href="structmoltk_1_1units_1_1Quantity.html#a6e64d268e7e3228f07f4342fe519503f">00199</a>         <a class="code" href="structmoltk_1_1units_1_1Quantity.html" title="Quantity represents a physical value with a unit, such as &quot;5.6 nanometers&quot;.">ThisType</a> <a class="code" href="structmoltk_1_1units_1_1Quantity.html#a6e64d268e7e3228f07f4342fe519503f">operator/</a>(<a class="code" href="namespacemoltk.html#afe6fbd8f5686b34143c2742fcc97292c" title="Real represents a real number, such as 5.6.">Real</a> rhs)<span class="keyword"> const </span>{
<a name="l00200"></a>00200             <span class="keywordflow">return</span> <a class="code" href="structmoltk_1_1units_1_1Quantity.html#a6a58dc9d5a0e3dfbad24bdb3ebe8f70a">ThisType</a>(<a class="code" href="structmoltk_1_1units_1_1Quantity.html#afaf8597b93b604c3980218dceefff4c8">value</a> / rhs);
<a name="l00201"></a>00201         }
<a name="l00202"></a>00202 
<a name="l00203"></a><a class="code" href="structmoltk_1_1units_1_1Quantity.html#ab58d874dedcaafc170d0fd5bf7ec8e32">00203</a>         <a class="code" href="structmoltk_1_1units_1_1Quantity.html" title="Quantity represents a physical value with a unit, such as &quot;5.6 nanometers&quot;.">ThisType</a> <a class="code" href="structmoltk_1_1units_1_1Quantity.html#ab58d874dedcaafc170d0fd5bf7ec8e32">operator/=</a>(<a class="code" href="namespacemoltk.html#afe6fbd8f5686b34143c2742fcc97292c" title="Real represents a real number, such as 5.6.">Real</a> rhs) {
<a name="l00204"></a>00204             <a class="code" href="structmoltk_1_1units_1_1Quantity.html#afaf8597b93b604c3980218dceefff4c8">value</a> /= rhs;
<a name="l00205"></a>00205             <span class="keywordflow">return</span> *<span class="keyword">this</span>;
<a name="l00206"></a>00206         }
<a name="l00207"></a>00207 
<a name="l00208"></a>00208         <span class="comment">// value = Quantity / unit</span>
<a name="l00209"></a><a class="code" href="structmoltk_1_1units_1_1Quantity.html#a5145bbae1ab8e4e6ec19406444d33116">00209</a>         Y <a class="code" href="structmoltk_1_1units_1_1Quantity.html#a6e64d268e7e3228f07f4342fe519503f">operator/</a>(<span class="keyword">const</span> U&amp; rhs)<span class="keyword"> const</span>
<a name="l00210"></a>00210 <span class="keyword">        </span>{
<a name="l00211"></a>00211             <span class="keywordflow">return</span> <a class="code" href="structmoltk_1_1units_1_1Quantity.html#afaf8597b93b604c3980218dceefff4c8">value</a>;
<a name="l00212"></a>00212         }
<a name="l00213"></a>00213 
<a name="l00214"></a><a class="code" href="structmoltk_1_1units_1_1Quantity.html#af4917e20cd799687b98f8c35ffde3864">00214</a>         Y <a class="code" href="structmoltk_1_1units_1_1Quantity.html#a6e64d268e7e3228f07f4342fe519503f">operator/</a>(<span class="keyword">const</span> <a class="code" href="structmoltk_1_1units_1_1Quantity.html" title="Quantity represents a physical value with a unit, such as &quot;5.6 nanometers&quot;.">ThisType</a>&amp; rhs)<span class="keyword"> const</span>
<a name="l00215"></a>00215 <span class="keyword">        </span>{
<a name="l00216"></a>00216             <span class="keywordflow">return</span> <a class="code" href="structmoltk_1_1units_1_1Quantity.html#afaf8597b93b604c3980218dceefff4c8">value</a>/rhs.<a class="code" href="structmoltk_1_1units_1_1Quantity.html#afaf8597b93b604c3980218dceefff4c8">value</a>;
<a name="l00217"></a>00217         }
<a name="l00218"></a>00218 
<a name="l00220"></a>00220         <span class="comment">// Comparison operators //</span>
<a name="l00222"></a>00222 <span class="comment"></span>
<a name="l00223"></a><a class="code" href="structmoltk_1_1units_1_1Quantity.html#a27921a4cf8c63864b769ad7976cbe46b">00223</a>         <span class="keywordtype">bool</span> <a class="code" href="structmoltk_1_1units_1_1Quantity.html#a27921a4cf8c63864b769ad7976cbe46b">operator==</a>(<span class="keyword">const</span> <a class="code" href="structmoltk_1_1units_1_1Quantity.html" title="Quantity represents a physical value with a unit, such as &quot;5.6 nanometers&quot;.">ThisType</a>&amp; rhs)<span class="keyword"> const </span>
<a name="l00224"></a>00224 <span class="keyword">        </span>{
<a name="l00225"></a>00225             <span class="keywordflow">return</span> <a class="code" href="structmoltk_1_1units_1_1Quantity.html#afaf8597b93b604c3980218dceefff4c8">value</a> == rhs.<a class="code" href="structmoltk_1_1units_1_1Quantity.html#afaf8597b93b604c3980218dceefff4c8">value</a>;
<a name="l00226"></a>00226         }
<a name="l00227"></a>00227 
<a name="l00228"></a><a class="code" href="structmoltk_1_1units_1_1Quantity.html#a72197a47bfe285299e5a69331cd98f3c">00228</a>         <span class="keywordtype">bool</span> <a class="code" href="structmoltk_1_1units_1_1Quantity.html#a72197a47bfe285299e5a69331cd98f3c">operator!=</a>(<span class="keyword">const</span> <a class="code" href="structmoltk_1_1units_1_1Quantity.html" title="Quantity represents a physical value with a unit, such as &quot;5.6 nanometers&quot;.">ThisType</a>&amp; rhs)<span class="keyword"> const</span>
<a name="l00229"></a>00229 <span class="keyword">        </span>{
<a name="l00230"></a>00230             <span class="keywordflow">return</span> <a class="code" href="structmoltk_1_1units_1_1Quantity.html#afaf8597b93b604c3980218dceefff4c8">value</a> != rhs.<a class="code" href="structmoltk_1_1units_1_1Quantity.html#afaf8597b93b604c3980218dceefff4c8">value</a>;
<a name="l00231"></a>00231         }
<a name="l00232"></a>00232 
<a name="l00233"></a><a class="code" href="structmoltk_1_1units_1_1Quantity.html#aa6847d2ba5b7a0138d8665ca0f8ce761">00233</a>         <span class="keywordtype">bool</span> <a class="code" href="structmoltk_1_1units_1_1Quantity.html#aa6847d2ba5b7a0138d8665ca0f8ce761">operator&lt;</a>(<span class="keyword">const</span> <a class="code" href="structmoltk_1_1units_1_1Quantity.html" title="Quantity represents a physical value with a unit, such as &quot;5.6 nanometers&quot;.">ThisType</a>&amp; rhs)<span class="keyword"> const </span>
<a name="l00234"></a>00234 <span class="keyword">        </span>{
<a name="l00235"></a>00235             <span class="keywordflow">return</span> <a class="code" href="structmoltk_1_1units_1_1Quantity.html#afaf8597b93b604c3980218dceefff4c8">value</a> &lt; rhs.<a class="code" href="structmoltk_1_1units_1_1Quantity.html#afaf8597b93b604c3980218dceefff4c8">value</a>;
<a name="l00236"></a>00236         }
<a name="l00237"></a>00237 
<a name="l00238"></a><a class="code" href="structmoltk_1_1units_1_1Quantity.html#acbce9fad1f4e1212db36ae2a6c743da4">00238</a>         <span class="keywordtype">bool</span> <a class="code" href="structmoltk_1_1units_1_1Quantity.html#acbce9fad1f4e1212db36ae2a6c743da4">operator&gt;</a>(<span class="keyword">const</span> <a class="code" href="structmoltk_1_1units_1_1Quantity.html" title="Quantity represents a physical value with a unit, such as &quot;5.6 nanometers&quot;.">ThisType</a>&amp; rhs)<span class="keyword"> const </span>
<a name="l00239"></a>00239 <span class="keyword">        </span>{
<a name="l00240"></a>00240             <span class="keywordflow">return</span> <a class="code" href="structmoltk_1_1units_1_1Quantity.html#afaf8597b93b604c3980218dceefff4c8">value</a> &gt; rhs.<a class="code" href="structmoltk_1_1units_1_1Quantity.html#afaf8597b93b604c3980218dceefff4c8">value</a>;
<a name="l00241"></a>00241         }
<a name="l00242"></a>00242 
<a name="l00243"></a><a class="code" href="structmoltk_1_1units_1_1Quantity.html#a1c7751da671d42bd317a61cc842e71dc">00243</a>         <span class="keywordtype">bool</span> <a class="code" href="structmoltk_1_1units_1_1Quantity.html#a1c7751da671d42bd317a61cc842e71dc">operator&lt;=</a>(<span class="keyword">const</span> <a class="code" href="structmoltk_1_1units_1_1Quantity.html" title="Quantity represents a physical value with a unit, such as &quot;5.6 nanometers&quot;.">ThisType</a>&amp; rhs)<span class="keyword"> const </span>
<a name="l00244"></a>00244 <span class="keyword">        </span>{
<a name="l00245"></a>00245             <span class="keywordflow">return</span> <a class="code" href="structmoltk_1_1units_1_1Quantity.html#afaf8597b93b604c3980218dceefff4c8">value</a> &lt;= rhs.<a class="code" href="structmoltk_1_1units_1_1Quantity.html#afaf8597b93b604c3980218dceefff4c8">value</a>;
<a name="l00246"></a>00246         }
<a name="l00247"></a>00247 
<a name="l00248"></a><a class="code" href="structmoltk_1_1units_1_1Quantity.html#a621e1c64967405195e8d78ef9b999917">00248</a>         <span class="keywordtype">bool</span> <a class="code" href="structmoltk_1_1units_1_1Quantity.html#a621e1c64967405195e8d78ef9b999917">operator&gt;=</a>(<span class="keyword">const</span> <a class="code" href="structmoltk_1_1units_1_1Quantity.html" title="Quantity represents a physical value with a unit, such as &quot;5.6 nanometers&quot;.">ThisType</a>&amp; rhs)<span class="keyword"> const </span>
<a name="l00249"></a>00249 <span class="keyword">        </span>{
<a name="l00250"></a>00250             <span class="keywordflow">return</span> <a class="code" href="structmoltk_1_1units_1_1Quantity.html#afaf8597b93b604c3980218dceefff4c8">value</a> &gt;= rhs.<a class="code" href="structmoltk_1_1units_1_1Quantity.html#afaf8597b93b604c3980218dceefff4c8">value</a>;
<a name="l00251"></a>00251         }
<a name="l00252"></a>00252 
<a name="l00253"></a>00253         <span class="comment">// I/O</span>
<a name="l00254"></a>00254 
<a name="l00255"></a><a class="code" href="structmoltk_1_1units_1_1Quantity.html#ac57b7359fc8745ea384f7f44beef89f4">00255</a>         <span class="keyword">inline</span> <span class="keyword">friend</span> std::ostream&amp; <a class="code" href="structmoltk_1_1units_1_1Quantity.html#ac57b7359fc8745ea384f7f44beef89f4">operator&lt;&lt;</a>(std::ostream&amp; os, <span class="keyword">const</span> <a class="code" href="structmoltk_1_1units_1_1Quantity.html" title="Quantity represents a physical value with a unit, such as &quot;5.6 nanometers&quot;.">ThisType</a>&amp; q)
<a name="l00256"></a>00256         {
<a name="l00257"></a>00257             os &lt;&lt; q.<a class="code" href="structmoltk_1_1units_1_1Quantity.html#afaf8597b93b604c3980218dceefff4c8">value</a> &lt;&lt; <span class="stringliteral">&quot; &quot;</span>;
<a name="l00258"></a>00258             ThisType::UnitType::write_symbol(os);
<a name="l00259"></a>00259             <span class="keywordflow">return</span> os;
<a name="l00260"></a>00260         }
<a name="l00261"></a>00261 
<a name="l00264"></a><a class="code" href="structmoltk_1_1units_1_1Quantity.html#a1b5c68279b4d51911fea08b5b5ecc3f4">00264</a>         <a class="code" href="structmoltk_1_1units_1_1Quantity.html#aaa757baa200137d668c47d6d7c2c9d9e">ValueType</a> <a class="code" href="structmoltk_1_1units_1_1Quantity.html#a1b5c68279b4d51911fea08b5b5ecc3f4" title="Proper way to extract value attribute - tell me the unit first.">value_in_unit</a>(<span class="keyword">const</span> <a class="code" href="structmoltk_1_1units_1_1Quantity.html#a4e3905fd140d4a6b630a6a0b73a93bdf">UnitType</a>&amp;)<span class="keyword"> const </span>{<span class="keywordflow">return</span> <a class="code" href="structmoltk_1_1units_1_1Quantity.html#afaf8597b93b604c3980218dceefff4c8">value</a>;}
<a name="l00265"></a>00265 
<a name="l00266"></a>00266     <span class="keyword">protected</span>:
<a name="l00267"></a><a class="code" href="structmoltk_1_1units_1_1Quantity.html#a44d541571f12421505b168b2c8287aeb">00267</a>         <span class="keyword">explicit</span> <a class="code" href="structmoltk_1_1units_1_1Quantity.html#a44d541571f12421505b168b2c8287aeb">Quantity</a>(<span class="keyword">const</span> Y&amp; v) : <a class="code" href="structmoltk_1_1units_1_1Quantity.html#afaf8597b93b604c3980218dceefff4c8">value</a>(v) {}
<a name="l00268"></a>00268     };
<a name="l00269"></a>00269 
<a name="l00270"></a>00270 
<a name="l00271"></a>00271     <span class="comment">// GCCXML on Windows does not like real * unit to be defined</span>
<a name="l00272"></a>00272     <span class="comment">// inline friend within Quantity; so define it here.</span>
<a name="l00273"></a>00273     <span class="comment">// Quantity = value * unit, e.g. noseLength = 5.6 * centimeter;</span>
<a name="l00274"></a>00274     <span class="keyword">template</span>&lt;<span class="keyword">class</span> Y, <span class="keyword">class</span> D&gt;
<a name="l00275"></a><a class="code" href="namespacemoltk_1_1units.html#ae70e223abf96ece060ee5f9abdcd4a51">00275</a>     <a class="code" href="structmoltk_1_1units_1_1Quantity.html" title="Quantity represents a physical value with a unit, such as &quot;5.6 nanometers&quot;.">Quantity&lt;Unit&lt;D&gt;</a>, Y&gt; <a class="code" href="namespacemoltk_1_1units.html#ae70e223abf96ece060ee5f9abdcd4a51">operator*</a>(<span class="keyword">const</span> Y&amp; lhs, <span class="keyword">const</span> <a class="code" href="structmoltk_1_1units_1_1Unit.html" title="Unit represents a unit of measure, such as gram, nanometer, or second.">Unit&lt;D&gt;</a>&amp; rhs) 
<a name="l00276"></a>00276     {
<a name="l00277"></a>00277         <span class="keywordflow">return</span> <a class="code" href="structmoltk_1_1units_1_1Quantity.html" title="Quantity represents a physical value with a unit, such as &quot;5.6 nanometers&quot;.">Quantity&lt;Unit&lt;D&gt;</a>, Y&gt;(lhs, rhs);
<a name="l00278"></a>00278     }
<a name="l00279"></a>00279     <span class="comment">// int * unit version</span>
<a name="l00280"></a>00280     <span class="keyword">template</span>&lt;<span class="keyword">class</span> D&gt;
<a name="l00281"></a><a class="code" href="namespacemoltk_1_1units.html#a8d012a0a2dfa2a1e669293bfcb153e99">00281</a>     <a class="code" href="structmoltk_1_1units_1_1Quantity.html" title="Quantity represents a physical value with a unit, such as &quot;5.6 nanometers&quot;.">Quantity&lt;Unit&lt;D&gt;</a>, <a class="code" href="namespacemoltk.html#afe6fbd8f5686b34143c2742fcc97292c" title="Real represents a real number, such as 5.6.">Real</a>&gt; <a class="code" href="namespacemoltk_1_1units.html#ae70e223abf96ece060ee5f9abdcd4a51">operator*</a>(<span class="keywordtype">int</span> lhs, <span class="keyword">const</span> <a class="code" href="structmoltk_1_1units_1_1Unit.html" title="Unit represents a unit of measure, such as gram, nanometer, or second.">Unit&lt;D&gt;</a>&amp; rhs) 
<a name="l00282"></a>00282     {
<a name="l00283"></a>00283         <span class="keywordflow">return</span> <a class="code" href="structmoltk_1_1units_1_1Quantity.html" title="Quantity represents a physical value with a unit, such as &quot;5.6 nanometers&quot;.">Quantity&lt;Unit&lt;D&gt;</a>, <a class="code" href="namespacemoltk.html#afe6fbd8f5686b34143c2742fcc97292c" title="Real represents a real number, such as 5.6.">Real</a>&gt;((<a class="code" href="namespacemoltk.html#afe6fbd8f5686b34143c2742fcc97292c" title="Real represents a real number, such as 5.6.">Real</a>)lhs, rhs);
<a name="l00284"></a>00284     }
<a name="l00285"></a>00285 
<a name="l00286"></a>00286     <span class="keyword">template</span>&lt;<span class="keyword">class</span> Y, <span class="keyword">class</span> D&gt;
<a name="l00287"></a>00287     <span class="keyword">typename</span> Quantity&lt;Unit&lt;D&gt;, Y&gt;::SquareRootType
<a name="l00288"></a><a class="code" href="namespacemoltk_1_1units.html#a6bf43e6d5d5ccf3983219f867212f7f6">00288</a>     <a class="code" href="namespacemoltk_1_1units.html#a6bf43e6d5d5ccf3983219f867212f7f6">sqrt</a>(<span class="keyword">const</span> <a class="code" href="structmoltk_1_1units_1_1Quantity.html" title="Quantity represents a physical value with a unit, such as &quot;5.6 nanometers&quot;.">Quantity</a>&lt;<a class="code" href="structmoltk_1_1units_1_1Unit.html" title="Unit represents a unit of measure, such as gram, nanometer, or second.">Unit&lt;D&gt;</a>, Y&gt; q)
<a name="l00289"></a>00289     {
<a name="l00290"></a>00290         <span class="keyword">typedef</span> <span class="keyword">typename</span> <a class="code" href="structmoltk_1_1units_1_1Quantity.html" title="Quantity represents a physical value with a unit, such as &quot;5.6 nanometers&quot;.">Quantity&lt;Unit&lt;D&gt;</a>, Y&gt;::SquareRootType ResultType;
<a name="l00291"></a>00291         <span class="keyword">typedef</span> Quantity&lt;Unit&lt;D&gt;, Y&gt; ArgType;
<a name="l00292"></a>00292         <span class="keywordflow">return</span> ResultType(
<a name="l00293"></a>00293             <a class="code" href="namespacemoltk_1_1units.html#a6bf43e6d5d5ccf3983219f867212f7f6">sqrt</a>(q.value_in_unit(ArgType::UnitType::get_instance())), 
<a name="l00294"></a>00294             ResultType::UnitType::get_instance());
<a name="l00295"></a>00295     }
<a name="l00296"></a>00296 
<a name="l00297"></a>00297     <span class="comment">// Quantity * Quantity composition</span>
<a name="l00298"></a>00298     <span class="comment">// Took this out of member functions to avoid unlimited instantiation in python.</span>
<a name="l00299"></a>00299     <span class="keyword">template</span>&lt;<span class="keyword">class</span> D, <span class="keyword">class</span> Y&gt;
<a name="l00300"></a>00300     <span class="keyword">typename</span> Quantity&lt;Unit&lt;D&gt;, Y&gt;::SquareType
<a name="l00301"></a><a class="code" href="namespacemoltk_1_1units.html#ac37533c25584c87bd737f25a9e214ef5">00301</a>     <a class="code" href="namespacemoltk_1_1units.html#ae70e223abf96ece060ee5f9abdcd4a51">operator*</a>(<span class="keyword">const</span> <a class="code" href="structmoltk_1_1units_1_1Quantity.html" title="Quantity represents a physical value with a unit, such as &quot;5.6 nanometers&quot;.">Quantity</a>&lt;<a class="code" href="structmoltk_1_1units_1_1Unit.html" title="Unit represents a unit of measure, such as gram, nanometer, or second.">Unit&lt;D&gt;</a>, Y&gt;&amp; lhs, <span class="keyword">const</span> <a class="code" href="structmoltk_1_1units_1_1Quantity.html" title="Quantity represents a physical value with a unit, such as &quot;5.6 nanometers&quot;.">Quantity</a>&lt;<a class="code" href="structmoltk_1_1units_1_1Unit.html" title="Unit represents a unit of measure, such as gram, nanometer, or second.">Unit&lt;D&gt;</a>, Y&gt;&amp; rhs)
<a name="l00302"></a>00302     {
<a name="l00303"></a>00303         <span class="keyword">typedef</span> <a class="code" href="structmoltk_1_1units_1_1Quantity.html" title="Quantity represents a physical value with a unit, such as &quot;5.6 nanometers&quot;.">Quantity&lt;Unit&lt;D&gt;</a>, Y&gt; ArgType;
<a name="l00304"></a>00304         <span class="keyword">const</span> <a class="code" href="structmoltk_1_1units_1_1Unit.html" title="Unit represents a unit of measure, such as gram, nanometer, or second.">Unit&lt;D&gt;</a>&amp; unit1 = <a class="code" href="structmoltk_1_1units_1_1Unit.html#a826fc8257f93873c15845a01e465dfc3">Unit&lt;D&gt;::get_instance</a>();
<a name="l00305"></a>00305         <span class="keyword">typedef</span> <span class="keyword">typename</span> ArgType::SquareType SquareType;
<a name="l00306"></a>00306         <span class="keywordflow">return</span> SquareType(lhs.value_in_unit(unit1) * rhs.value_in_unit(unit1),
<a name="l00307"></a>00307                 SquareType::UnitType::get_instance());
<a name="l00308"></a>00308     }
<a name="l00309"></a>00309 
<a name="l00311"></a><a class="code" href="namespacemoltk_1_1units.html#a84d2541f1ab08c8ae38bea32fa7b33ca">00311</a>     <span class="keyword">typedef</span> <a class="code" href="structmoltk_1_1units_1_1Quantity.html" title="Quantity represents a physical value with a unit, such as &quot;5.6 nanometers&quot;.">Quantity&lt;BitUnit&gt;</a> <a class="code" href="namespacemoltk_1_1units.html#a84d2541f1ab08c8ae38bea32fa7b33ca" title="Information is a quantity in units of bits.">Information</a>;
<a name="l00313"></a><a class="code" href="namespacemoltk_1_1units.html#a5800c5371d9ddac68ae3edf51b0e3881">00313</a>     <span class="keyword">typedef</span> <a class="code" href="structmoltk_1_1units_1_1Quantity.html" title="Quantity represents a physical value with a unit, such as &quot;5.6 nanometers&quot;.">Quantity&lt;NanometerUnit&gt;</a> <a class="code" href="namespacemoltk_1_1units.html#a5800c5371d9ddac68ae3edf51b0e3881" title="Length is a length quantity in units of nanometers.">Length</a>;
<a name="l00315"></a><a class="code" href="namespacemoltk_1_1units.html#a0f80bfeb5b82472c01b5611877ab75eb">00315</a>     <span class="keyword">typedef</span> <a class="code" href="structmoltk_1_1units_1_1Quantity.html" title="Quantity represents a physical value with a unit, such as &quot;5.6 nanometers&quot;.">Quantity&lt;RadianUnit&gt;</a> <a class="code" href="namespacemoltk_1_1units.html#a0f80bfeb5b82472c01b5611877ab75eb" title="Angle is a quantity in radians.">Angle</a>;
<a name="l00316"></a>00316 
<a name="l00317"></a><a class="code" href="namespacemoltk_1_1units.html#ac050671e9310a1b41bd10ceef0ffa3be">00317</a>     <span class="keyword">inline</span> <a class="code" href="namespacemoltk.html#afe6fbd8f5686b34143c2742fcc97292c" title="Real represents a real number, such as 5.6.">Real</a> <a class="code" href="namespacemoltk_1_1units.html#ac050671e9310a1b41bd10ceef0ffa3be">sin</a>(<span class="keyword">const</span> <a class="code" href="structmoltk_1_1units_1_1Quantity.html" title="Quantity represents a physical value with a unit, such as &quot;5.6 nanometers&quot;.">Angle</a>&amp; angle) {<span class="keywordflow">return</span> <a class="code" href="namespacemoltk_1_1units.html#ac050671e9310a1b41bd10ceef0ffa3be">std::sin</a>(angle.<a class="code" href="structmoltk_1_1units_1_1Quantity.html#a1b5c68279b4d51911fea08b5b5ecc3f4" title="Proper way to extract value attribute - tell me the unit first.">value_in_unit</a>(<a class="code" href="namespacemoltk_1_1units.html#a516154a0a09f1ce7437b739ce48e0409">radian</a>));}
<a name="l00318"></a><a class="code" href="namespacemoltk_1_1units.html#aee4bd73aa460f5124d4025406ead2998">00318</a>     <span class="keyword">inline</span> <a class="code" href="namespacemoltk.html#afe6fbd8f5686b34143c2742fcc97292c" title="Real represents a real number, such as 5.6.">Real</a> <a class="code" href="namespacemoltk_1_1units.html#aee4bd73aa460f5124d4025406ead2998">cos</a>(<span class="keyword">const</span> <a class="code" href="structmoltk_1_1units_1_1Quantity.html" title="Quantity represents a physical value with a unit, such as &quot;5.6 nanometers&quot;.">Angle</a>&amp; angle) {<span class="keywordflow">return</span> <a class="code" href="namespacemoltk_1_1units.html#aee4bd73aa460f5124d4025406ead2998">std::cos</a>(angle.<a class="code" href="structmoltk_1_1units_1_1Quantity.html#a1b5c68279b4d51911fea08b5b5ecc3f4" title="Proper way to extract value attribute - tell me the unit first.">value_in_unit</a>(<a class="code" href="namespacemoltk_1_1units.html#a516154a0a09f1ce7437b739ce48e0409">radian</a>));}
<a name="l00319"></a>00319 
<a name="l00320"></a>00320 }} <span class="comment">// namespace moltk::units</span>
<a name="l00321"></a>00321 
<a name="l00322"></a>00322 
<a name="l00323"></a>00323 <span class="preprocessor">#endif // MOLTK_UNITS_H</span>
<a name="l00324"></a>00324 <span class="preprocessor"></span>
</pre></div></div>
</div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark">&#160;</span>Friends</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>



<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.5.1
</small></address>

</body>
</html>
